import {defineStore} from "pinia";

// export const useLoginStore = defineStore("login", {
//     actions: {
//         login({token, role}: { token: string, role: string }) {
//             this.token = token;
//             this.role = role;
//             localStorage.setItem("token", token);
//             localStorage.setItem("role", role);
//         }
//     },
//
//     state() {
//         return {
//             token: localStorage.getItem("token") || '',
//             role: localStorage.getItem("role") || '',
//         }
//     },
// })


export const useLoginStore = defineStore("login", {
    actions: {
        login(role:string) {
            this.role = role;
            localStorage.setItem("role", role);
        }
    },

    state() {
        return {
            role: localStorage.getItem("role") || '',
        }
    },
})
